import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'
import router from './router'
import './assets/css/global.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/fonts/iconfont.css'

import { config } from 'vue/types/umd'
// var Koa = require('koa');
// var cors = require('koa2-cors');
 
// var app = new Koa();
// app.use(cors());
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
Vue.prototype.$http = axios
axios.interceptors.request.use(config => {
  console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

// const express = require('express')
// const app = express()
// var across = express();
//设置跨域访问
// app.all('*', function(req,response,next) {
 
// //设置允许跨域的域名，*代表允许任意域名跨域
// response.header("Access-Control-Allow-Origin", "*");
// //允许的header类型
// response.header("Access-Control-Allow-Headers", "X-Requested-With");
// //跨域允许的请求方式
// response.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
// //设置响应头信息
// response.header("X-Powered-By",' 3.2.1')
// response.header("Content-Type", "application/json;charset=utf-8");
//  next();
// });



// const cors = require('cors')

 
// app.use(cors());


Vue.use(ElementUI);
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
